package com.hdoit.ares.web.official.modelconfig;
import com.hdoit.ares.web.official.providers.ArticalClassifyTreeProvider;
import com.hdoit.ares.web.official.providers.ImportantTypeProvider;
import com.hdoit.ares.web.official.providers.MedioTypeProvider;
import com.tennetcn.common.enums.regular.MathRegularExpressions;
import com.tennetcn.common.enums.regular.RegularExpressions;
import com.tennetcn.component.attribute.DateTimeAttribute;
import com.tennetcn.component.attribute.DisplayNameAttribute;
import com.tennetcn.component.attribute.DropDownListAttribute;
import com.tennetcn.component.attribute.RegularExpressionAttribute;
import com.tennetcn.component.attribute.SwitchAttribute;
import com.tennetcn.component.attribute.TreeListAttribute;
import com.tennetcn.component.attribute.base.ModelMetadataAttributeConfiguration;
import com.tennetcn.web.cbase.providers.YesOrNoSwitchProdiver;

/**
 * @author      yujinhui
 * @email       
 * @createtime  2018年01月10日 10:19:02
 * @comment
 */
public class ArticalConfig extends ModelMetadataAttributeConfiguration{
    public ArticalConfig(){
        this.setProperty("title")
            .hasAttribute(new DisplayNameAttribute("标题"));

        this.setProperty("typeId")
            .hasAttribute(new DisplayNameAttribute("文章分类"))
            .hasAttribute(new TreeListAttribute(new ArticalClassifyTreeProvider()));

        this.setProperty("importantType")
            .hasAttribute(new DisplayNameAttribute("文章重要性"))
            .hasAttribute(new DropDownListAttribute(new ImportantTypeProvider()));

        this.setProperty("display")
            .hasAttribute(new DisplayNameAttribute("是否显示"))
            .hasAttribute(new SwitchAttribute(new YesOrNoSwitchProdiver()));

        this.setProperty("createTime")
            .hasAttribute(new DisplayNameAttribute("创建时间"))
            .hasAttribute(new DateTimeAttribute());

        this.setProperty("simple")
            .hasAttribute(new DisplayNameAttribute("摘要"));

        this.setProperty("author")
            .hasAttribute(new DisplayNameAttribute("文章作者"));

        this.setProperty("email")
            .hasAttribute(new DisplayNameAttribute("邮箱"))
            .hasAttribute(new RegularExpressionAttribute(RegularExpressions.email));

        this.setProperty("keyword")
            .hasAttribute(new DisplayNameAttribute("关键字"));

        this.setProperty("href")
            .hasAttribute(new DisplayNameAttribute("外部链接"));

        this.setProperty("imgUrl")
            .hasAttribute(new DisplayNameAttribute("图片地址"));

        this.setProperty("videoUrl")
            .hasAttribute(new DisplayNameAttribute("视频地址"));
        
        this.setProperty("fileUrl")
        	.hasAttribute(new DisplayNameAttribute("文件地址"));

        this.setProperty("content")
            .hasAttribute(new DisplayNameAttribute("文章内容"));
        
        this.setProperty("introduction")
        	.hasAttribute(new DisplayNameAttribute("文章/视频简介"));
        
        this.setProperty("medioType")
    		.hasAttribute(new DisplayNameAttribute("媒体类型"))
        	.hasAttribute(new DropDownListAttribute(new MedioTypeProvider()));
   
        this.setProperty("sort")
        	.hasAttribute(new DisplayNameAttribute("排序字段"))
        	.hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber));
    }
}